<?php

// generates a imdb link

function smarty_function_imdb($params, &$smarty)
{

    $url = 'http://www.imdb.com';
    $new_window = $smarty->_tpl_vars['member']['pref']['imdb_window'];
    $title = 'IMDB';
    $image	= false;

    foreach($params as $_key => $_val) {
        switch($_key) {
			case 'url':
				$$_key = (string)$_val;
				break;

			case 'window':
				$new_window = (int)$_val;
				break;

			case 'title':
				$$_key = (string)$_val;
				break;

			case 'image':
				$image = (bool)$_val;
        }
    }

	$window = ($new_window == 1) ? 'target="_blank"' : null;

	if($image) {
		//$title = '<img src="" alt="Visit IMDB" />';
	}

	return '<a href="'. $url .'" '. $window .'>'. $title .'</a>';

}

?>
